Views using Structured SQL

This example uses structured SQL to define a new table code_counts using columns from the stocks table.

creating views structured bipp

creating views structured bipp

Select the columns:

creating views structured columns

bipp generates the SQL:

SELECT t000.code AS _0, t000.number_of_rows AS _1
FROM (
    SELECT t000.code AS code, Count(*) AS number_of_rows
    FROM `online_retail`.`stocks` AS t000 GROUP BY 1
) AS t000
GROUP BY 1, 2

Fetch the data:

creating views structured results

Alternatively, you can shorten the SQL statement to stocks, select the same columns and obtain the same results:

Changing the definition of code_counts from the previous example:

creating views structured results alternative

bipp generates the SQL:

SELECT t000.code AS _0, t000.number_of_rows AS _1
FROM (
    SELECT t000.description like '%TAPE%' AS is_tape,
        t000.code AS code,
        t000.description AS description,
        Count(*) AS number_of_rows
    FROM `online_retail`.`stocks` AS t000
    GROUP BY 1, 2, 3
) AS t000
GROUP BY 1, 2

IN THIS PAGE